fix(tests): isolate integration caches from user state#1067
Conversation
Run the test process under a private temporary HOME and clear inherited CBM_CACHE_DIR so production index paths and legacy fixtures resolve to the same isolated cache. Make lang-contract fixtures honor an explicit cache override and remove the sentinel tree at process exit, including after early assertion returns. Validated on Windows with the full runner: 5828 passed, 22 skipped; a 500-project user cache had zero files added or removed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: tmonestudio <tmonestudio@users.noreply.github.com>
|
Thanks for isolating integration-test caches from real user state. This is a high-priority 0.9.1-rc safety fix. Review will verify that every relevant test redirects both cache and configuration roots, restores environment state on all exits, and cannot read or mutate a developer installation. |
|
Merged (bb9677f). Verified the isolation works end-to-end: ran the integration + lang_contract suites against a build with your change and confirmed the developer's real |
What does this PR do?
Prevents the C test runner from reading or writing a user's real codebase-memory cache.
Several integration fixtures exercise the production
index_repositoryflow. The production cache resolver prefersCBM_CACHE_DIR, while older fixtures derive the expected database path fromHOME/.cache/codebase-memory-mcp. When the runner inherited a real cache, early assertion returns could leave fixture databases behind. Setting onlyCBM_CACHE_DIRwas also insufficient because those legacy paths diverged.Fix
HOMEfor every normal test-runner process;CBM_CACHE_DIR, so production code and legacy fixtures converge on the private HOME cache;atexit, including after early test returns;CBM_CACHE_DIRwhen a test intentionally sets one.Worker/probe subprocess modes still exit before the sentinel setup.
Validation
Windows GCC build after rebasing onto current
main:The same run previously left
cbm_seq898_*,cbm_lc_*, andcbm_fcw_*fixture databases in the inherited cache.Checklist
git commit -s)